/*#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>

int main()
{
	char a2[200] = { 0 }, b2[200] = { 0 };

	
	
	while (scanf("%s", a2) != EOF)
	{
		int flag = 1,sum=0,f=1;
		f = a2[0] - '0';
		if (!f)
			break;
		int count = 0,i;
		count = strlen(a2);
		for (i = 0; i < count; i++)
		
			b2[i] = a2[i] - '0';
		for (i = count - 1; i >= 0; i--)
		{
			sum += b2[i] * flag;
			flag *= 2;
		}
		printf("%X\n", sum);

	}
	return 0;

}*/